/*
 * =====================================================================================
 *
 *       Filename:  router_msg.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/05/2018 07:40:10 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *   Organization:  
 *
 * =====================================================================================
 */
#ifndef __ROUTER_MSG_H__
#define __ROUTER_MSG_H__
#include <netinet/in.h>

#define WANTTYPE_PPPOE	(1)
#define WANTYPE_LAN	(2)

/* router level:
 * 0: normal
 * 1: idc*/
enum {
	ROUTER_TYPE_NORMAL,
	ROUTER_TYPE_IDC,
};

enum {
	CMD_REG = 1,
	CMD_PING = 2,
	CMD_PONG = 3,
	CMD_BIND = 4,
	CMD_REBOOT = 5,
	CMD_RES = 6,
};

#pragma pack(1)
struct router_info_t {
	uint8_t routerlevel;
	uint8_t wantype;
	uint32_t speed;
	uint8_t mac[6];
	char  addr[INET6_ADDRSTRLEN];
};

struct router_reg {
	uint8_t cmd;
	struct router_info_t routerinfo;
};

struct router_ping {
	uint8_t cmd;
	char data[5];
};

struct router_pong {
	uint8_t cmd;
	char data[5];
};

struct router_reboot {
	uint8_t cmd;
};

struct router_bind {
	uint8_t cmd;
	struct sockaddr_storage storage;
};
#pragma pack()
#endif
